/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package bean;

import controller.EditLab;
import controller.ListLabs;
import entities.Lab;
import java.util.List;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

/**
 *
 * @author QUY-THI
 */
@ManagedBean
@SessionScoped
public class ListLabsBean {

    private List<Lab> labs;
    private Lab lab;

    public List<Lab> getLabs() {
        ListLabs l = new ListLabs();
        return l.getLabs();
    }

    public void setLabs(List<Lab> labs) {
        this.labs = labs;
    }

    public Lab getLab() {
        return lab;
    }

    public void setLab(Lab lab) {
        this.lab = lab;
    }

    /**
     * Creates a new instance of ListLabsBean
     */
    public ListLabsBean() {
    }

    public String activate() {
        lab.setStatus(Boolean.TRUE);
        EditLab eu = new EditLab();
        eu.resultEdit(lab);
        return "labInfo.xhtml?faces-redirect=true";
    }

    public String deactivate() {
        lab.setStatus(Boolean.FALSE);
        EditLab eu = new EditLab();
        eu.resultEdit(lab);
        return "labInfo.xhtml?faces-redirect=true";
    }
}
